package com.yiwyn.flowdemo.utils;

import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.AviatorEvaluatorInstance;
import com.googlecode.aviator.Expression;

import java.util.Map;

public class AviatorUtils {

    // 创建执行器
    private static final AviatorEvaluatorInstance engine = AviatorEvaluator.getInstance();

    public static Object execute(String expression, Map<String, Object> variables) {
        Expression compile = engine.compile(expression, true);
        return compile.execute(variables);
    }
}
